﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
using MvvmLight1.ViewModel;

namespace MvvmLight1
{
    public class ObjectToVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        // Conver from MediaElement Source to Boolean
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null) 
                    return true;
            return false;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }

        #endregion
    }

    public class PlayerStatusToVisibilityConverter : IValueConverter
    {
        #region IValueConverter Members

        // Convert from MediaElement Status to Boolean
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is PlayerStatus)
                return !((PlayerStatus)value == PlayerStatus.Stop);
            return true;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }

        #endregion
    }
}
